import edu.smu.tspell.wordnet.*;

public class Main {
  public static void main(String[] args) {
    System.setProperty("wordnet.database.dir", "C:\\Program Files\\WordNet-3.0\\dict\\");
    
    String filePath = null;
    String[] query = null;

    String[][] sampleQueries = new String[][]{
      {"bios/einstein.txt", "When was he born"},
      {"bios/einstein.txt", "Why was he famous"},
      {"bios/einstein.txt", "Where did he work"},
    };
    if (args.length < 2) {
      args = sampleQueries[2];
    }
    
    filePath = args[0];
    if (filePath == null) {
      filePath = "src/input.txt";
    }

    if (args.length < 2) {
      query = new String[1];
      query[0] = "";
    } else if (args.length == 2) {
      query =  args[1].split(" ");
    } else {
      System.out.println("Usage: java Main input.txt \"query\"");
      return;
    }

    System.out.println("Source: " + filePath);
    System.out.print("Queries:\t");
    for (String q : query) {
      System.out.print(q + "\t");
    }
    System.out.println();

    Generator generator = new Generator();
    
    /**************************************
     * Toggle whether synonyms are used.
     **************************************/
    generator.UseSynonyms = true;
    generator.UsePositional = true;
    generator.UseLinking = true;
    
    generator.loadFile(filePath);
    generator.readLinkWords();
    generator.setQuery(query);

    System.out.print("Keywords extracted from queries: ");
    for (String s : generator.getKeywords()) {
      System.out.print(s + "\t");
    }
    System.out.println();

    // generator.setKeywords(keywords);
    // generator.generateSignificantSentences();
    // System.out.println(generator.generateSummary());
    System.out.println(generator.generateSummaryToFile());
    // generator.generateSummary();
  }
}
